package com.simpleim.starter;

import com.simpleim.starter.server.ChatServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication(scanBasePackages = "com.simpleim.starter")
public class SimpleServerApplication {
    public static void main(String[] args) {
        ApplicationContext applicationContext = SpringApplication.run(SimpleServerApplication.class, args);

        // 启动ChatServer
        startChatServer(applicationContext);
    }

    /**
     * 启动聊天服务器
     */
    private static void startChatServer(ApplicationContext applicationContext) {
        ChatServer chatServer = applicationContext.getBean(ChatServer.class);
        chatServer.run();
    }
}
